package com.myzl.web.controller.visualization;

import com.myzl.coal.domain.AlarmEvent;
import com.myzl.coal.domain.RealTimeData;
import com.myzl.coal.service.IAlarmEventService;
import com.myzl.coal.service.IDeviceService;
import com.myzl.coal.service.IRealTimeDataService;
import com.myzl.common.core.domain.AjaxResult;
import com.myzl.common.enums.HandleStatusEnum;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName VisualizationControl
 * @Author wzb
 * @Date 2023/6/7 15:02
 * @Description
 */
@RestController
@Slf4j
@Data
@RequestMapping("/visualization/homePage/")
public class HomePageVisualizationController {
    private final IRealTimeDataService realTimeDataService;
    private final IAlarmEventService alarmEventService;
    private final IDeviceService deviceService;

    @GetMapping(value = "getInfo")
    public AjaxResult getInfo(Integer deviceId) {
        RealTimeData realTimeData = new RealTimeData();
        if (deviceId!=null){
            realTimeData.setDeviceId(deviceId);
        }
        return AjaxResult.success(realTimeDataService.selectRealTimeDataList(realTimeData));
    }

    @GetMapping(value = "getPolice")
    public AjaxResult getPolice() {
        AlarmEvent alarmEvent = new AlarmEvent();
        alarmEvent.setHandleStatus(HandleStatusEnum.UNHANDLED.getCode());
        return AjaxResult.success(alarmEventService.selectAlarmEventList(alarmEvent));
    }



}
